package main

import (
    "config"
    "fmt"
    "log"
    "os"
    "time"
)

func main() {
    fmt.Println("- NIH imageboard archiver -")

    cfg := config.Defaults

    // Create image directories if they do not already exist.
    os.MkdirAll(cfg.ThumbDir, 0777)
    os.MkdirAll(cfg.ImgDir, 0777)

    log.Println("Starting board monitors")
    for name, board := range config.Boards {
        log.Printf("Watching %s", name)
        go watchBoard(board)
    }

    for {
        log.Println("Main thread will now sleep. Good night.")
        time.Sleep(24 * time.Hour) // Now sleep forever while goroutines handle the work.
    }
}
